// book.js
import request from '../utils/request'

// 根据经纬度获取当前地址
// export function getCurrentCity(lat,lng){
//     return request({
//         method:'GET',
//         url:`https://apis.netstart.cn/maoyan/city/latlng?lat=${lat}&lng=${lng}`
//     })
// }
// （首页）请求所有城市
export function getCity() {
    return request({
        method: 'GET',
        url: 'https://apis.netstart.cn/maoyan/cities.json',
    })
}
// （首页）最受好评电影列表
export function getTopRatedMovies(){
    return request({
        method:'GET',
        url:'https://apis.netstart.cn/maoyan/index/topRatedMovies'
    })
}

// 电影详情
export function getMovieDetail(id = ""){
    return request({
        method:'GET',
        url:`https://apis.netstart.cn/maoyan/movie/detail?movieId=${id}`
    })
}

// （首页）影院筛选条件
export function filterCinemas(ci: number){
    return request({
        method:'GET',
        url:`https://apis.netstart.cn/maoyan/index/filterCinemas?ci=${ci}`
    })
}
// （首页）热映列表
export function getMovieOnInfoList(){
    return request({
        method:'GET',
        url:'https://apis.netstart.cn/maoyan/index/movieOnInfoList'
    })
}
// （首页）影院列表
export function getCinemas(ci: number,day:string,districtId=-1,hallType=-1,brandId=-1,serviceId=-1,areaId=-1,stationId=-1){
    return request({
        method:'GET',
        // url:`https://apis.netstart.cn/maoyan/index/moreCinemas?day=${day}&offset=${offset}&limit=${limit}&districtId=${districtId}&lineId=-1&hallType=${hallType}&brandId=${brandId}&serviceId=${serviceId}&areaId=-1&stationId=-1&item&updateShowDay=true&reqId=1636710166221&cityId=${ci}`,
        url:`https://apis.netstart.cn/maoyan/index/moreCinemas?movieId=0&day=${day}&offset=0&limit=20&districtId=${districtId}&lineId=-1&hallType=${hallType}&brandId=${brandId}&serviceId=${serviceId}&areaId=${areaId}&stationId=${stationId}&updateShowDay=true&reqId=1679303876729&cityId=${ci}`
    })
}
// 影院详情
export function cinemaDetail(id:number) {
    return request({
        method: 'GET',
        url: `https://apis.netstart.cn/maoyan/cinema/detail?cinemaId=${id}`,
    })
}
// 正在上映电影列表
export function cinemaShow(cinemaId:number,ci:number) {
    return request({
        method: 'GET',
        url: `https://apis.netstart.cn/maoyan/cinema/shows?cinemaId=${cinemaId}&ci=${ci}&channelId=4`,
    })
}
// 影院超值套餐
export function queryDealList() {
    return request({
        method: 'GET',
        url: `https://apis.netstart.cn/maoyan/cinema/queryDealList.json`,
    })
}
// 近期最受期待列表
export function mostExpected(ci:number) {
    return request({
        method: 'GET',
        url: `https://apis.netstart.cn/maoyan/index/mostExpected?ci=${ci}&limit=10&offset=0`,
    })
}
// 待映列表
export function comingList(ci:number) {
    return request({
        method: 'GET',
        url: `https://apis.netstart.cn/maoyan/index/comingList?ci=${ci}&limit=10`,
    })
}
// 经典电影列表
export function moreClassicList() {
    return request({
        method: 'GET',
        url: `https://apis.netstart.cn/maoyan/index/moreClassicList?sortId=1&showType=3&limit=10&offset=0`,
    })
}
// 搜索建议
export function searchSuggest(kw:string,cityId:number) {
    return request({
        method: 'GET',
        url: `https://apis.netstart.cn/maoyan/search/suggest?kw=${kw}&cityId=${cityId}`,
    })
}
// 影片播放影院
// export function movieCinemas(date:string,cityId:number,movieId:number) {
//     return request({
//         method: 'GET',
//         url: `https://m.maoyan.com/api/mtrade/mmcs/cinema/v2/select/movie/cinemas.json?limit=20&offset=0&utm_term=7.5&client=iphone&channelId=4&showDate=${date}&movieId=${movieId}&sort=distance&cityId=${cityId}&ci=${cityId}&lat=23.659122&lng=113.470836&districtId=-1&lineId=-1&areaId=-1&stationId=-1&brandIds=[-1]&serviceIds=[-1]&hallTypeIds=[%22all%22]&languageIds=[%22all%22]&dimIds=[%22all%22]`,
//     })
// }
// 在线选座
export function seat() {
    return request({
        method: 'GET',
        url: `https://apis.netstart.cn/maoyan/cinema/seat-m.json`,
    })
}
// 演出页（今日必抢）
export function getPaly() {
    return request({
        method: 'GET',
        url: 'https://show.maoyan.com/maoyansh/myshow/ajax/performances/rob/main?uuid=u90pmzu8xi9jtrpdf1fmw8avro59cfm51wv6e35df85bkll9v0k8gi3j45d2goqk&clientType=1&os=1&sellChannel=13&cityId=1',
        httpsAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/110.0.0.0"
    })
}

// 演出页（七日精选）
export function getWeek(page = 1) {
    return request({
        method: 'GET',
        url: `https://show.maoyan.com/maoyansh/myshow/ajax/recommend/performances?pageNo=${page}&pageSize=12&sellChannel=13&cityId=1`,
        httpsAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/110.0.0.0"
    })
}

// 演出页（榜单）
export function getRank() {
    return request({
        method: 'GET',
        url: `https://show.maoyan.com/maoyansh/myshow/ajax/ranks?sellChannel=13&cityId=1&lng=0&lat=0`,
    })
}

// 演出页（艺人）
export function getArtists() {
    return request({
        method: 'GET',
        url: `https://show.maoyan.com/maoyansh/myshow/ajax/celebrityBasicList/query?uuid=abguzyurjo9wqt8emr12h5ldped4vkp8p7z4jkjzjtixou750ck204d1zc66nthr&sellChannel=13&cityId=1`,
    })
}

// 演出页（为你推荐）
export function getRecommend() {
    return request({
        method: 'GET',
        url: `https://show.maoyan.com/maoyansh/myshow/ajax/performances/calendar/0;pageNo=1;pageSize=40;st=10;timeFilterType=4?uuid=abguzyurjo9wqt8emr12h5ldped4vkp8p7z4jkjzjtixou750ck204d1zc66nthr&clientType=1&os=1&sellChannel=13&cityId=1`,
    })
}

// 演出页的搜索页(搜索结果)
export function getSearch(key = "") {
    return request({
        method: 'GET',
        url: `https://show.maoyan.com/maoyansh/myshow/ajax/search/0;k=${key};st=0;p=1;s=20;tft=0?sellChannel=13&cityId=1&lng=0&lat=0`,
    })
}

// 演出页的搜索页(搜索结果)
export function getPlayDetail(id = "") {
    return request({
        method: 'GET',
        url: `https://show.maoyan.com/maoyansh/myshow/ajax/v2/performance/${id}?buyInstructionType=1&sellChannel=13&cityId=1&lng=0&lat=0`,
    })
}